//
//  JLXXMyViewController.m
//  JLXXTools
//
//  Created by apple on 2017/7/1.
//  Copyright © 2017年 cnsuer. All rights reserved.
//

#import "JLXXMyViewController.h"
#import "AlertTool.h"
#import "MMPopupItem.h"
#import "MMSheetView.h"
#import "JLXXDateView.h"

@interface JLXXMyViewController ()

@end

@implementation JLXXMyViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    ;

}
- (IBAction)click1:(id)sender {
    [AlertTool showInView:self.view withTitle:@"aaa"];
}

- (IBAction)click2:(id)sender {
    [AlertTool showInView:self.view onlyWithTitle:@"bb"];
}
- (IBAction)click3:(id)sender {
    [AlertTool showErrorInView:self.view withTitle:@"bbb"];
    
}
- (IBAction)click4:(id)sender {
    [AlertTool showInView:self.view];
    
}
- (IBAction)click5:(id)sender {
    [AlertTool sheetStyleWithTitle:@"艹" message:@"垃圾" needCancelCallBack:NO cancelButtonTitle:@"取消" destructiveButtonTitle:nil presentingController:self otherButtonTitles:@[@"1",@"3",@"5",@"7"] callbackBlock:^(NSInteger index) {
        NSLog(@"index: %lu",index);
    }];
}
- (IBAction)click6:(id)sender {
    [AlertTool alertStyleWithTitle:@"艹" message:@"垃圾" needCancelCallBack:NO cancelButtonTitle:@"取消" destructiveButtonTitle:@"确定" presentingController:self otherButtonTitles:@[@"other",@"1other",@"2other",@"3other"] callbackBlock:^(NSInteger index) {
        NSLog(@"index: %lu",index);
    }];
}

- (IBAction)click7:(id)sender {
    [AlertTool alertStyleWithTitle:@"艹" message:@"垃圾" needCancelCallBack:YES cancelButtonTitle:@"取消" destructiveButtonTitle:@"确定" textFiledPlaceholder:@"hahahhahahha" textFieldKeyboardType:UIKeyboardTypeDefault presentingController:self otherButtonTitles:@[@"other",@"1other",@"2other",@"3other"] callbackBlock:^(NSInteger index, UITextField * _Nullable textField) {
        NSLog(@"index: %lu",index);
    }];
    
}

- (IBAction)click8:(id)sender {
    JLXXDateView *dateView = [JLXXDateView new];
    dateView.confirm = ^(NSDate *date) {
        NSLog(@"%@",date);
    };
    [dateView show];
}

- (IBAction)click9:(id)sender {
    MMPopupItemHandler block = ^(NSInteger index){
        NSLog(@"clickd %@ button",@(index));
    };
    NSArray *items =
    @[MMItemMake(@"设为首页展示", MMItemTypeNormal, block),
      MMItemMake(@"设为参赛作品", MMItemTypeNormal, block),
      MMItemMake(@"取消　　　　", MMItemTypeNormal, nil)];
    
    MMSheetView *sheetView = [[MMSheetView alloc] initWithTitle:nil items:items images:@[@"设为首页展示",@"设为参赛作品",@"设为参赛作品"]];
    sheetView.attachedView.mm_dimBackgroundBlurEnabled = NO;
    [sheetView show];
}

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [AlertTool hidden];
}

@end
